package com.theo.mapper;

import com.theo.entity.FactInfo;
import com.theo.entity.TypeInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 方涛
 * @since 2021-02-02
 */
@Repository
public interface TypeInfoMapper extends BaseMapper<TypeInfo> {

    /**
     * 查询帖子板块的标签
     * @return
     */
    @Select("SELECT * FROM `type_info` \n" +
            "WHERE SUBSTR(`type_id`,1,4)='0001' AND CHAR_LENGTH(`type_id`)=8\n")
    List<TypeInfo> queryTopicTypeInfo();

    /**
     * 查询百科版本的标签
     * @return
     */
    @Select("SELECT * FROM `type_info` \n" +
            "WHERE SUBSTR(`type_id`,1,4)='0002' AND CHAR_LENGTH(`type_id`)=8\n")
    List<TypeInfo> queryFactTypeInfo();

    int saveTypeInfo(TypeInfo typeInfo);

    int deleteTypeInfo(Integer id);

    int updateTypeInfo(Integer id);
}
